package com.dp.controller;


import com.dp.dto.Result;
import com.dp.entity.ShopType;
import com.dp.service.IShopTypeService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 */
@RestController
@RequestMapping("/shop-type")
public class ShopTypeController {

    @Resource
    private IShopTypeService typeService;
//    private StringRedisTemplate stringRedisTemplate;
    @GetMapping("list")
    public Result queryTypeList() {
//         typeList = List.of();
//        stringRedisTemplate.opsForList().getOperations();

        List<ShopType> typeList = typeService
                .query().orderByAsc("sort").list();
//        stringRedisTemplate.opsForList().leftPop(typeList.toString());

        return Result.ok(typeList);

        //从redis查询商铺缓存


        //判断是否存在

            //存在直接返回

        }
        //不存在，根据id查询数据库

        }
        //存在，缓存到redis并返回





